<template>
  <!-- <nav>
    <router-link to="/">Home</router-link> |
    <router-link to="/about">About</router-link>
  </nav> -->
  <router-view />
</template>

<script>
import { useRoute } from 'vue-router';
import { showWarning } from './hooks/useMyMessageBox';
import myAxios from './myAxios/myAxios';
import store from './store';
export default {
  name: 'app',
  setup () {

    let spListParams = '';
    // 如果当前网址包含 outsideApply 字符串,不发起请求
    if (window.location.href.includes('outsideApply')) {

    }
    else {
      myAxios.get('陈帅廷查询驱动访客系统审批人', spListParams).then(res => {
        if (res instanceof Array) {
          store.state.spList.length = 0;
          store.state.spList.push(...res);
        }
        else {
          showWarning('获取审批人数据失败res!' + res);
        }
      }).catch((err) => {
        showWarning('获取审批人数据失败err!' + err);
      });

      myAxios.get('陈帅廷查询驱动访客系统所有在线车牌', '').then(res => {
        if (res instanceof Array) {
          store.state.onlineCars.length = 0;
          store.state.onlineCars.push(...res[0]['CARIDS'].split(','));
        }
        else {
          showWarning('获取在线车牌失败res!' + res);
        }
      }).catch((err) => {
        showWarning('获取在线车牌失败err!' + err);
      });

    }
    return {};
  },
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;
}

nav a {
  font-weight: bold;
  color: #2c3e50;
}

nav a.router-link-exact-active {
  color: #42b983;
}
</style>
